package com.navinfo.platform.basicdatastatistics.dto;

import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

@Data
public class VehicleHourInfoDto implements Serializable {
    public static String[] hourKeys;
    static {
        hourKeys = new String[24];
        for(int i=0;i<24;i++){
            hourKeys[i] = "hour" + i;
        }
    }
    private Map<String, VehicleHourBean> vehicleHourBeanMap = new HashMap<>();
    @Data
    public static class VehicleHourBean {
        private Integer state;
        private Integer time;
        private Integer mileage;
        private Integer fuel;

        public void accumulationTime(Integer time){
            if(time == null){
                return;
            }
            if(this.time == null){
                this.time = time;
                return;
            }
            this.time += time;
        }
        public void accumulationMileage(Integer mileage){
            if(mileage == null){
                return;
            }
            if(this.mileage == null){
                this.mileage = mileage;
                return;
            }
            this.mileage += mileage;
        }
        public void accumulationFuel(Integer fuel){
            if(fuel == null){
                return;
            }
            if(this.fuel == null){
                this.fuel = fuel;
                return;
            }
            this.fuel += fuel;
        }
    }
}


